﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GeoWeb.Common;

namespace GeoWeb.Demo.Commons
{
    public partial class GeoFtpHelper_Demo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            funGeoFtpHelper();
        }

        #region GeoFtpHelper
        private void funGeoFtpHelper()
        {
            byte[] filearr = IOHelper.FileToStreamByte(@"d:\ReleaseList.xml");
            //ftp上传,url中必须要加文件名
            Uri uri = new Uri("ftp://10.3.1.220/ReleaseList.xml");
            FtpHelper ftper = new FtpHelper(uri);
            string response = ftper.Upload(filearr);

            //ftp下载
            Uri uri1 = new Uri("ftp://10.3.1.220/ReleaseList.xml");
            FtpHelper ftper1 = new FtpHelper(uri1);
            filearr = ftper1.Download();

            //ftp下载读取
            Uri uri2 = new Uri("ftp://10.3.1.220/ReleaseList.xml");
            FtpHelper ftper2 = new FtpHelper(uri2);
            string strContents = ftper2.GetFileContents();
        }
        #endregion
    }
}